<%@ page contentType="text/html; charset=UTF-8" import="org.apache.commons.lang3.StringUtils,org.apache.log4j.*,java.lang.Integer" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>日志级别调整</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
     <script src="https://code.jquery.com/jquery.js"></script>
      <!-- 包括所有已编译的插件 -->
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
      <style type="text/css">
      .bs-docs-home 
            { 
            background-color: #F1E1C6; 
           
            } 
      </style>
</head>
<body class="bs-docs-home"> 
    <div class="container theme-showcase"> 
        <h1 style=" line-height:2em;"> </h1><br /> 
       
        <div class="row"> 
            <div class="col-sm-3"></div> 
        <div class="col-sm-6"> 
            <div class="panel panel-primary"> 
                <div class="panel-heading"> 
                    <h3 class="panel-title"><strong>修改log4j日志界别</strong></h3> 
                </div> 
                <div class="panel-body"> 
<%
    String name= request.getParameter("name");
    String level = request.getParameter("level");
	if(StringUtils.isNotBlank(name) && StringUtils.isNotBlank(level)){
		try{
			LogManager.getRootLogger().getLogger(name).setLevel(Level.toLevel(level, Level.ERROR));
			%>
			 <div class="alert btn-success"> 
                 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                     修改日志级别成功
             </div> 
			<%
		} catch (Exception e) {
			%>
			 <div class="alert alert-danger alert-dismissable"> 
	             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
	             <strong>注意!</strong>设置日志页面错误页面错误
             </div> 
			<%
		}
	}
%>

<form role="form" name="form1" method="method" onsubmit="return checkForm()"> 
    <div class="form-group"> 
        <label for="Subject"><small>输入包名或完成类名,如：cn.modoumama</small></label> 
        <input type="text" class="form-control" id="name" name="name" placeholder="">  
    </div>
    <label for="Subject"><small>请输入日志级别:</small></label> 
    <select class="form-control" name="level">
		 <option value="FATAL">致命</option>
		 <option selected="selected" value="ERROR">错误</option>
		 <option value="WARN">警告</option>
		 <option value="INFO">信息</option>
		 <option value="DEBUG">调试</option>
		 <option value="ALL">全部</option>
		 <option value="TRACE">微量</option>
		 <option value="OFF">关闭</option>
    </select>
    <button type="subbimt" class="btn btn-success btn-primary">提交</button>
</form> 
   </div> 
               </div> 
           </div> 
      
           <div class="col-sm-3"></div> 
        </div> 
    </div>  
</body>
</html>